-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add baseline-immutables plugin to enable incremental compilation for Immutables #1750
Conversation
Generate changelog in
|
8b86a46
to
5ec992b
Compare
project.getPluginManager().withPlugin("java", unused -> { | ||
project.afterEvaluate(proj -> { | ||
proj.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().stream() | ||
.filter(sourceSet -> hasImmutablesProcessor(project, sourceSet)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary to avoid compiler warnings about unrecognized annotation processor options.
warning: The following options were not recognized by any processor: '[immutables.gradle.incremental]'
error: warnings found and -Werror specified
1 error
1 warning
Have you verified this internally? |
5ec992b
to
7892a7b
Compare
Yes, see the internal PR link above. I've also testing this locally and have not seen any unexpected behavior. |
Ah sorry, you meant the plugin. Will verify that also. |
Yep, I just want to make sure the plugin works as intended before we ship it. |
I've verified locally that this works as expected. |
Released 3.81.0 |
@Override | ||
public void apply(Project project) { | ||
project.getPluginManager().withPlugin("java", unused -> { | ||
project.afterEvaluate(proj -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tracking down this immutables behaviour and building this plugin! I'm excited for the speedup it should give repos.
Just made a follow up PR to remove this use of afterEvaluate - it's technically deprecated (although I don't think Gradle will ever be able to remove it) and the proliferation of afterEvaluates has caused us issues in the past to do with the order they run in. Luckily, we can use some of the newer lazy APIs to avoid this: #1752
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, thanks for fixing this! Didn't know that afterEvaluate
was deprecated. Wasn't sure when this should be applied so I just copied code from an existing plugin.
Before this PR
Most of our internal projects use the Immutables annotation processor to generate immutable value objects.
Unfortunately, the Immutables processor does not support incremental compilation by default. This means that even trivial changes to subprojects that use the Immutables processor trigger a full rebuild.
For more details, see https://g.p.b/foundry/multipass/pull/11849.
After this PR
Fortunately, Immutables has opt-in support for enabling incremental compilation. See immutables/immutables#804.
This PR adds the
baseline-immutables
plugin to enable incremental compilation for source sets using the Immutables processor.In my testing, I haven't encountered any issues and it dramatically improves compilation times during incremental work, which is fairly typical in dev workflows.